import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:wanAndroid/widget/BaseLoadWidget.dart';

import 'BaseRefreshWidget.dart';
import 'ListBaseWidget.dart';

class RefreshState extends BaseRefreshState {
  @override
  void initState() {
    super.initState();
  }

  get refreshView {
    return Container(
      child: SizedBox(
        child: Row(
          children: <Widget>[
            Text("$refreshText"),
            CircularProgressIndicator(
                valueColor: new AlwaysStoppedAnimation<Color>(Colors.orange))
          ],
          mainAxisAlignment: MainAxisAlignment.center,
        ),
      ),
      alignment: Alignment.center,
    );
  }

  @override
  Widget getRefreshWidget(
      BuildContext context, PullRefreshStatus refreshStatus) {
    switch (refreshStatus) {
      case PullRefreshStatus.LOADING:
        refreshText = "正在刷新...";
        return refreshView;
      case PullRefreshStatus.RELEASE:
        refreshText = "释放刷新...";
        return refreshView;
      case PullRefreshStatus.LOAD_FINISH:
        refreshText = "刷新结束...";
        return refreshView;
      case PullRefreshStatus.DRAG:
      default:
        refreshText = "下拉刷新";
        return refreshView;
    }
  }
}
